package cn.le.InternalClass;

import cn.le.InternalClass.inter.Contents;
import cn.le.InternalClass.inter.Destination;

/**
 * Created by admin on 2017/4/14.
 * 内部类可以向上转型期接口和父类型
 */
public class Parce {
    //私有类型的内部类,只有Parce自己能能访问它
    private class PContents implements Contents {
        private int i = 11;
        @Override
        public int valut() {
            return i;
        }
    }
    //protected类型的内部类,只有Parce或其子类，还有与Parce同一个包中的类能访问
    //因为protected也给予了包访问权限
    protected class PDestintation implements Destination{

        private String label;

        public PDestintation(String label) {
            this.label = label;
        }
        @Override
        public String readLabel() {
            return label;
        }
    }
    public Destination destination(String s)
    {
        return new PDestintation(s);
    }
    public Contents contents()
    {
        return new PContents();
    }

    public static void main(String[] args) {

        Parce p = new Parce();
        Contents c = p.contents();

        Destination d =  p.destination("Tasmania");

        Parce.PContents pc = p.new PContents();
        System.out.println(pc.valut()+":"+pc.i);

    }

}
